import java.util.Random;

public class Producer implements Runnable {
    private Buffer buffer;
    private volatile static int elem;
    //------------------------------------------------------
    public Producer(Buffer buffer) {
        this.buffer = buffer;
    }
    //------------------------------------------------------
    @Override
    public void run() {
        while (true){
            try {
                Thread.sleep(2090);
            } catch (InterruptedException e) {
                System.out.println("Ex. producer" + e);
            }
            buffer.put(elem++);
        }
    }
    //------------------------------------------------------
}//End class Producer
